/**
 * 被护理老人统计
 */
$(function(){
    showelder();
    let url ='../statistics/listElderyear'
    function showelder(status){
        layui.use('table', function(){
            var table = layui.table;

            //数据表格渲染
            var tableIns=table.render({
                elem: '#showelder'
                ,id:'elder'
                ,url:'../statistics/listEldermonth6'
                ,height:390
                ,cellMinWidth: 80//全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,request:{
                    pageName: 'pn' //页码的参数名称，默认：page
                    ,limitName: 'limit' //每页数据量的参数名，默认：limit
                }

                ,parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
                    return {
                        "code": 0, //解析接口状态
                        "msg": '', //解析提示文本
                        "count": res.length, //解析数据长度
                        "data": res, //解析数据列表
                    }
                }
                ,cols: [[
                    {field:'time',width:200,title:'月份',align:'center',sort:true,fixed:'left'},
                    {field:'fuwushu',width:200,title:'服务人次',align: 'center'},
                    {field:'leijishu',width:200,title:'累计数',align: 'center'},
                    {field:'youxiaozhengchang',width:200,title:'有效正常',align: 'center'},
                    {field:'youxiaozanting',width:200,title:'有效暂停',align: 'center'},
                    {field:'wuxiaoqushi',width:200,title:'无效去世',align: 'center'},
                    {field:'lr_wuxiaozhuanchu',width:200,title:'无效转出',align: 'center'},
                ]]
                ,page:true
            });
            var tableIns=table.render({
                elem: '#showyear'
                ,id:'year'
                ,url:url
                ,height:390
                ,cellMinWidth: 80//全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,request:{
                    pageName: 'pn' //页码的参数名称，默认：page
                    ,limitName: 'limit' //每页数据量的参数名，默认：limit
                }

                ,parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
                    return {
                        "code": 0, //解析接口状态
                        "msg": '', //解析提示文本
                        "count": res.length, //解析数据长度
                        "data": res, //解析数据列表
                    }
                }
                ,cols: [[
                    {field:'time',width:200,title:'月份',align:'center',sort:true,fixed:'left'},
                    {field:'fuwushu',width:200,title:'服务人次',align: 'center'},
                    {field:'leijishu',width:200,title:'累计数',align: 'center'},
                    {field:'youxiaozhengchang',width:200,title:'有效正常',align: 'center'},
                    {field:'youxiaozanting',width:200,title:'有效暂停',align: 'center'},
                    {field:'wuxiaoqushi',width:200,title:'无效去世',align: 'center'},
                    {field:'lr_wuxiaozhuanchu',width:200,title:'无效转出',align: 'center'},
                ]]
                ,page:true
            });



            var tableIns=table.render({
                elem: '#showelder'
                ,id:'yearall'
                ,url:'../statistics/listEldermonth6'
                ,height:390
                ,cellMinWidth: 80//全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,request:{
                    pageName: 'pn' //页码的参数名称，默认：page
                    ,limitName: 'limit' //每页数据量的参数名，默认：limit
                }

                ,parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
                    return {
                        "code": 0, //解析接口状态
                        "msg": '', //解析提示文本
                        "count": res.length, //解析数据长度
                        "data": res, //解析数据列表
                    }
                }
                ,cols: [[
                    {field:'time',width:200,title:'月份',align:'center',sort:true,fixed:'left'},
                    {field:'fuwushu',width:200,title:'服务人次',align: 'center'},
                    {field:'leijishu',width:200,title:'累计数',align: 'center'},
                    {field:'youxiaozhengchang',width:200,title:'有效正常',align: 'center'},
                    {field:'youxiaozanting',width:200,title:'有效暂停',align: 'center'},
                    {field:'wuxiaoqushi',width:200,title:'无效去世',align: 'center'},
                    {field:'lr_wuxiaozhuanchu',width:200,title:'无效转出',align: 'center'},
                ]]
                ,page:true
            });





        });

    }
    $(".searchBtn").click(function(){
        console.log($("#yearSearch").val())
        if ($("#yearSearch").val()){
            url='../statistics/listElderyear?year='+$("#yearSearch").val()
            showelder()
        }else{
            layer.msg('请选择年份')
        }

    });
});
